package com.itheima.travel.dao;

import com.itheima.travel.domain.ResultInfo;
import com.itheima.travel.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface UserDao {

    @Select("select * from tab_user where username=#{username}")
    User findByUsername(String username);

    @Select("select * from tab_user where telephone=#{telephone}")
    User findByTelephone(String telephone);

    @Insert("insert into tab_user values(null,#{username},#{password},#{telephone},#{salt})")
    Integer save(User user);

    @Select("select * from tab_user where uid=#{uid}")
    User getPersonal(Integer uid);

    void updatePersonal(@Param("nickname") String nickname, @Param("sex") String sex, @Param("birthday")String birthday, @Param("email") String email,@Param("username") String username);
}
